package com.gulimall.api.client;

import com.atguigu.common.utils.R;
import com.gulimall.api.to.SkuReductionTo;
import com.gulimall.api.to.SpuBoundTo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

//实现调用Nacos注册中心服务名为gulimall-coupon的微服务
@FeignClient("gulimall-coupon")
public interface CouponFeignService {

    //请求gulimall-coupon微服务的coupon/coupon/member/list资源
//定义需要调用服务提供者的方法申明即可。
//如此访问地址： http://gulimall-coupon/coupon/coupon/member/list
//OpenFeign它内部默认就集成了Ribbon的配置(负载均衡)， 会根据服务名gulimall-coupon
//到nacos注册中心获取服务名所对应的服务实例列表。得到服务实例的IP和端口号，替换掉请求地址的服务名
//http://192.168.126.1:7000/coupon/coupon/member/list
    @GetMapping("coupon/coupon/member/list")
    public R membercoupons();

    @PostMapping("coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);

    @PostMapping("coupon/skufullreduction/saveInfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);

}
